import { stringify } from 'querystring';
import request from '@/utils/request';
import { DEFAULT_URL_EVENT, DEFAULT_URL_EVENT_PROCESS, DEFAULT_URL_EVENT_PUSH } from '@/constants';

export async function queryData(parameter, body) {
    return request(`${DEFAULT_URL_EVENT}/list?${stringify(parameter)}`, { method: 'POST', body });
}

export async function saveData(option) {
    return request(`${DEFAULT_URL_EVENT}/insert`, option);
}

export async function updateData(option) {
    return request(`${DEFAULT_URL_EVENT}/update`, option);
}

export async function deleteData(option) {
    return request(`${DEFAULT_URL_EVENT}/remove`, option);
}

export async function topData(parameter, option) {
    return request(`${DEFAULT_URL_EVENT}/top?${stringify(parameter)}`, option);
}

export async function queryEventProcess(parameter, body) {
    return request(`${DEFAULT_URL_EVENT_PROCESS}/list?${stringify(parameter)}`, { method: 'POST', body });
}

export async function saveEventProcess(option) {
    return request(`${DEFAULT_URL_EVENT_PROCESS}/insert`, option);
}

export async function updateEventProcess(option) {
    return request(`${DEFAULT_URL_EVENT_PROCESS}/update`, option);
}

export async function deleteEventProcess(option) {
    return request(`${DEFAULT_URL_EVENT_PROCESS}/remove`, option);
}

export async function queryEventPush(parameter, body) {
    return request(`${DEFAULT_URL_EVENT_PUSH}/list?${stringify(parameter)}`, { method: 'POST', body });
}

export async function saveEventPush(option) {
    return request(`${DEFAULT_URL_EVENT_PUSH}/insert`, option);
}